package com.csc.finalproject.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table( name ="savingaccounts")
public class SavingAccount implements Serializable {
	/**
	 * relationship with AccountInfo
	 */
	@ManyToOne
	@JoinColumn( name ="accountinfoId")
	private AccountInfo accountInfo;
/*
 * attribute
 */
	@Id
	@Column
	private int savingAccountId;
	@Column
	private String name;
	@Column
	private double balance;
	/*
	 * contructor
	 */
	public SavingAccount() {
	
	}
	public SavingAccount(int savingAccountId, String name, double balance) {
		
		this.savingAccountId = savingAccountId;
		this.name = name;
		this.balance = balance;
	}
	
	public SavingAccount(AccountInfo accountInfo, int savingAccountId,
			String name, double balance) {
		super();
		this.accountInfo = accountInfo;
		this.savingAccountId = savingAccountId;
		this.name = name;
		this.balance = balance;
	}
	/*
	 * getter/setter
	 */
	public int getSavingAccountId() {
		return savingAccountId;
	}
	public void setSavingAccountId(int savingAccountId) {
		this.savingAccountId = savingAccountId;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public double getBalance() {
		return balance;
	}
	public void setBalance(double balance) {
		this.balance = balance;
	}
	public AccountInfo getAccountInfo() {
		return accountInfo;
	}
	public void setAccountInfo(AccountInfo accountInfo) {
		this.accountInfo = accountInfo;
	}
	
}
